<?php if(!defined('IN_APP')) exit('Access Denied');?>
<!DOCTYPE html>
<html lang="en">
<head>
	<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
	<meta charset="UTF-8">
	<title>登录</title>
	<meta name="description" content="">
	<meta name="keywords" content="">
	<meta name="viewport" content="initial-scale=1, width=device-width, maximum-scale=1, user-scalable=no">
	<meta name="format-detection" content="telephone=no,email=no,adress=no" />
	<meta name="apple-mobile-web-app-capable" content="yes" />  
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<link rel="stylesheet" href="<?php echo THEME_PATH;?>styles/swiper.min.css">
	<link rel="stylesheet" href="<?php echo THEME_PATH;?>styles/reset.css">
	<link rel="stylesheet" href="<?php echo THEME_PATH;?>styles/common.css">
	<link rel="stylesheet" href="<?php echo THEME_PATH;?>styles/style.css">
	<script src="<?php echo THEME_PATH;?>js/jquery-1.8.3.min.js"></script>
	<script type="text/javascript" src="<?php echo THEME_PATH;?>js/Validform_v5.3.2_min.js"></script>
	<script src="/statics/js/layer/layer.js"></script>
</head>
<body>
	<div class="login-logo-wrap">
		<img src="<?php echo THEME_PATH;?>images/login-logo.png" alt="" width="201" height="201">
	</div>
	<form action="<?php echo U('User/Public/login');?>" method="post" class="registerform" autocomplete="off">
		<ul class="login-wrap">
			<li class="flex">
				<label>
					<img src="<?php echo THEME_PATH;?>images/icon-user.png" alt="" width="16" height="16" class="ico">用户名
				</label>
				<input type="text" class="flex-1" placeholder="请输入用户名" name="username" datatype="m"  >
			</li>
			<li class="flex">
				<label>
					<img src="<?php echo THEME_PATH;?>images/icon-psd.png" alt="" width="16" height="16" class="ico">密&nbsp;&nbsp;&nbsp;码
				</label>
				<input type="password" class="flex-1" placeholder="请输入密码" name="password"  datatype="*6-16" >
			</li>
		</ul>
	</form>
	<a href="javascript:;" class="btn login-btn1">登录</a>
	<a href="/index.php?m=user&c=public&a=forget_password" class="login-forget">忘记密码</a>
	<a href="/index.php?m=user&c=public&a=register" class="login-go-sign">
		还没有账号
		<span class="register">前去注册&nbsp;&nbsp;<i class="iconfont">&#xe6a0;</i></span>
	</a>
</body>
<script>
	$('.login-btn1').click(function(){
		var username = $("input[name='username']").val();
		var password = $("input[name='password']").val();
		if(!username || !password){
			layer.msg('请输入手机号和密码');
		}
		if(!(/^1[34578]\d{9}$/.test(username))){
			layer.msg('请输入正确格式的手机号');
		}
		$.ajax({
				url:"/index.php/?m=user&c=public&a=login",
				type:'post',
				data:{
					username:username,
					password:password,
				},
				dataType:'json',
				success:function(data){
					if(data.status ==0){
						layer.msg(data.info);
					}else{
						layer.msg(data.info);
						setTimeout(function(){
        					location.href = "/index.php?m=user&c=trade&a=index";
    					},1000);
						
						return;
					}
				}
			});
	})
	// $('.login-btn1').click(function(){
	// 	$('.registerform').submit();
	// });
	// $(function() {
		// $(".registerform").Validform({
		// 	tiptype:function(msg,o,cssctl){
				
		// 		if(o.type==1){
		// 			o.obj.addClass("Validform_success")
		// 		}
		// 		if(o.type==3){
		// 			layer.msg(msg);
		// 			// layer.closeAll();
		// 			// tips(msg);
		// 			return false;
		// 		}
		// 	},
		// 	ajaxPost: true,
		// 	callback: function(ret) {
		// 	if (ret.status == 0) {
		// 		$('#error').css('display', 'block');
		// 		$('.input_1').focus(function(){
		// 		$('#error').css('display', 'none');
		// 		});
		// 		$('#error').html(ret.info);
		// 	} else {
		// 		// layer.msg(ret.msg,{icon: 1,time: 20000});
		// 		location.href = "/index.php?m=user&c=trade&a=index&type=buy";
		// 	}
		// 	}
		// });
	

	// })  
</script>
</html>